package com.project.communitymanagement.service.impl;

import com.project.communitymanagement.common.BaseServiceImpl;
import com.project.communitymanagement.entity.Remind;
import com.project.communitymanagement.mapper.RemindMapper;
import com.project.communitymanagement.service.RemindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ProjectName: epidemic-prevention-backend
 * @Package: com.project.communitymanagement.service.impl
 * @ClassName: RemindServiceImpl
 * @Author: "XGP"
 * @Description:
 * @Date: 2022/04/11 11:19
 * @Version: 1.0
 */
@Service
public class RemindServiceImpl  extends BaseServiceImpl<RemindMapper, Remind> implements RemindService {

    @Autowired
    private RemindMapper remindMapper;

    @Override
    protected RemindMapper mapper() {
        return remindMapper;
    }

    @Override
    protected Remind defaultModel() {
        return new Remind();
    }

    @Override
    public List<Remind> getAll() {
        return remindMapper.getAll();
    }

    @Override
    public int haveRead(List<Remind> list) {
        list.stream().forEach(item -> item.setStatus(1));
        return remindMapper.haveRead(list);
    }

    @Override
    public int save(Remind remind) {
        remind.setStatus(0);
        return super.save(remind);
    }
}

